﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="edit.aspx.cs" Inherits="StoreWeb.system.message.edit" %>

<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
<script type="text/javascript" src="../../lib/html5.js"></script>
<script type="text/javascript" src="../../lib/respond.min.js"></script>
<script type="text/javascript" src="../../lib/PIE_IE678.js"></script>
<![endif]-->
    <link href="../../css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link href="../../css/H-ui.admin.css" rel="stylesheet" type="text/css" />
    <link href="../../css/style.css" rel="stylesheet" type="text/css" />
    <link href="../../lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
    <!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
    <title>发送短信</title>
</head>
<body>
    <div class="pd-20">
        <form runat="server" method="post" class="form form-horizontal" id="formmemberadd">
            <div class="row cl">
                <label class="form-label col-2"><span class="c-red">*</span>接受人(客户)：</label>
                <div class="formControls col-6">
                    <%--<input type="text" class="input-text" value="" placeholder="" id="username" name="username" runat="server" datatype="*1-50" nullmsg="用户账户不能为空">--%>
                    <input name="name" type="text" id="selsect-name" class="input-text" style="width: 400px" placeholder="" readonly>
                    <input type="hidden" id="username-hidden" value="">
                  <a class="btn btn-primary radius" href="javascript:;" onclick="admin_role_add('选择接收人','adduser.aspx','860px','500px')"><i class="Hui-iconfont"></i> 选择接收人</a>
                    <%--<input style="width:200px;"  name="btnok2" value="选择接收人" id="btnok2" class="btn btn-success radius" onClick="admin_role_add('添加短消息', 'adduser.aspx', '860px', '500px')"/>--%>
                </div>
                <div class="col-4"></div>
            </div>
            <div class="row cl">
                <label class="form-label col-2">发送内容：</label>
                <div class="formControls col-6">
                       <asp:TextBox ID="scontent" placeholder="填写发送内容" runat="server" class="input-text" TextMode="MultiLine" Height="100px"  ></asp:TextBox>
                    <%--<input type="text" class="input-text" value="" placeholder="" id="smscontent" name="smscontent" runat="server">--%>
                    <%--<asp:TextBox ID="smscontent" name="smscontent"  placeholder="角色说明" runat="server" CssClass="s_input" TextMode="MultiLine" Height="159px" Width="227px"></asp:TextBox>--%>
                </div>
            </div>
            <div class="row cl">
                <div class="col-10 col-offset-2">
                   <%-- <asp:HiddenField ID="hidid" runat="server" />--%>
                    <input type="hidden" name="hidid" id="hidid" />
<%--                     <a href="javascript:history.go(-1)" class="btn btn-success radius" ID="btnok2" runat="server" visible="false">返回</a>--%>
                    <asp:Button ID="btnok" runat="server" CssClass="btn btn-success radius" Text="确定" />
                </div>
            </div>
        </form>
    </div>
    <script type="text/javascript" src="../../lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="../../lib/layer/1.9.3/layer.js"></script>
    <script type="text/javascript" src="../../lib/Validform/5.3.2/Validform.min.js"></script>
    <script type="text/javascript" src="../../lib/laypage/1.2/laypage.js"></script>
    <script type="text/javascript" src="../../lib/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="../../js/H-ui.js"></script>
    <script type="text/javascript" src="../../js/H-ui.admin.js"></script>
    <script>
        function admin_role_add(title, url, w, h) {
            //layer_show(title, url, w, h);
            var $input = $('#selsect-name');
            var $hidden = $('#username-hidden');
            var $checkbox;
            layer.open({
                type: 2,
                title: title,
                area: [w, h],
                content: url,
                btn: ['确定', '取消'],
                yes: function () {
                    var text = '';
                    var idText = '';
                    $.each($checkbox, function () {
                        var $this = $(this);
                        if ($this.is(':checked')) {
                            text += ($this.data('text') + ',');
                            idText += ($this.val() + ',')
                        }
                    });
                    if ('' == text)
                        layer.alert('请至少勾选一个接收人');
                    else {
                        $input.val(text.substring(0, text.length - 1));
                        $hidden.val(idText.substring(0, idText.length - 1));
                        layer.closeAll();
                    }
                },
                success: function () {
                    $checkbox = layer.getChildFrame('#myTable input.checkbox');
                    var val = $hidden.val();
                    if ('' != val) {
                        var idArray = val.split(',');
                        for (var i in idArray) {
                            layer.getChildFrame('#' + idArray[i]).attr('checked', 'checked');
                        }
                    }
                }
            });
        }
        $(function () {
            $("#formmemberadd").Validform({
                tiptype: 2,
                btnSubmit: "#btnok",
                beforeSubmit: function (curform) {
                    ////alert($('#username-hidden').val());
                    $.post("../../ajax/message.aspx", { ddluser: $('#username-hidden').val(), smscontent: $("#scontent").val(), id: $("#hidid").val() },
                    function (data) {
                        //alert(data);
                        if (data == 1) {
                            //parent.layer.alert("提交成功", function () {
                            //    // parent.location.reload();
                            //    window.location.href = "system/message/list.aspx";
                            //});
                            parent.layer.msg("提交成功", { icon: 1, time: 1000 });
                            window.location.href = "list.aspx";
                        } else if (data == 2) {
                            parent.layer.alert("修改成功", function () {
                                parent.location.reload();
                            });
                        } else if (data == 3) {
                                parent.location.reload();
                        } else {
                            parent.layer.msg("操作失败");;
                        }
                    });
                    return false;
                }
            });
        });
    </script>
</body>
</html>
